package com.cys.dm.client.order;

import com.cys.dm.entity.order.DmOrder;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author blue_t
 * @date 2020-12-27 9:05
 */
@FeignClient(name = "dm-order-provider")
@Component
public interface DmOrderClient {

    @PostMapping(path = "/addOrder")
    public Integer addOrder(@RequestBody DmOrder dmOrder);

    @PostMapping(path = "/delOrder/{orderNo}")
    public Integer delOrder(@PathVariable("orderNo")String orderNo);

    @PostMapping(path = "/findOrderByOrderNo/{orderNo}")
    public DmOrder findOrderByOrderNo(@PathVariable("orderNo")String orderNo);

    @PostMapping(path = "/updataOrderType")
    public Integer updataOrderType(@RequestParam("orderNo")String orderNo,@RequestParam("orderType")long orderType);

    @PostMapping(path = "/findByTypeAndTimeAndKey")
    public List<DmOrder> findByTypeAndTimeAndKey(@RequestParam(value = "orderType",required=false)Long orderType,
                                                 @RequestParam("orderTime")Long orderTime,
                                                 @RequestParam("keyword")String keyword,
                                                 @RequestParam("userId")Long userId);
}
